knitr::opts_chunk$set(echo = TRUE, message = FALSE, warning = FALSE)
StreamCatToolsIn the last lesson, we learned how to pull flowline and catchment
data from the NHD, and “travel” through its flowline network. In this
lesson, we will be exploring StreamCat,
an Environmental Protection Agency database that has linked up hundreds
of geospatial datasets to the NHD. Using similar tracing techniques to
the ones we explored in the last lesson, catchment-scale,
watershed-scale, and riparian-scale statistics have been derived for
each catchment in the NHD. Very recently, the EPA developed an R
package, StreamCatTools, that makes it insanely
easy to load in StreamCat data from StreamCat’s new new
API.
Figure 1: Schematic showing StreamCat’s geospatial framework. Adapted from StreamCat (https://www.epa.gov/national-aquatic-resource-surveys/streamcat-dataset-readme#geospatial).
Beyond StreamCatTools, we will be using the
tidyverse (like always!), sf and
mapview to display geospatial data, kableExtra
for interactive tables, and nhdplusTools to pull in NHD
features.
#library(devtools)
#install_github('USEPA/StreamCatTools')
library(tidyverse)
library(StreamCatTools)
library(sf)
library(mapview)
library(nhdplusTools)
library(kableExtra)
Let’s travel closer to home and explore geospatial data in the Colorado Front Range. The vast majority of this area is represented within the USGS gage “South Platte River Near Kersey, CO” (USGS-06754000)’s watershed:
s_platte_ws <- get_nldi_basin(list(featureSource = "nwissite", featureID = "USGS-06754000"))
s_platte_flowlines <- nhdplusTools::get_nhdplus(AOI = s_platte_ws,
realization = "flowline")
s_platte_catchments <- nhdplusTools::get_nhdplus(AOI = s_platte_ws,
realization = "catchment") %>%
dplyr::filter(featureid %in% s_platte_flowlines$comid | sf::st_covered_by(., s_platte_ws, sparse = FALSE))
mapview(s_platte_catchments) + mapview(s_platte_ws)